﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NationalInstruments.UI.WindowsForms;

namespace 发电机舱
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            gauge1.Value = -1;
        }

        private void gauge1_BeforeChangeValue(object sender, NationalInstruments.UI.BeforeChangeNumericValueEventArgs e)
        {
            Gauge f = (Gauge)sender;
            if (e.NewValue > f.Range.Maximum)
            {
                f.Value = f.Range.Maximum;
                e.Cancel = true;
            }
            else if (e.NewValue < f.Range.Minimum)
            {
                f.Value = f.Range.Minimum;
                e.Cancel = true;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            gauge1.Value = 2000;
        }

        private void gauge1_AfterChangeValue(object sender, NationalInstruments.UI.AfterChangeNumericValueEventArgs e)
        {
        }
    }
}
